﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

using HA.Data;

using HA.ModFlow.Controls;

using HA.ModFlow.Controls.DisplayOptions;

namespace HA.ModFlow.Controls.Windows.DisplayOptions
{
    /// <summary>
    /// winDisplayOption.xaml 的交互逻辑
    /// </summary>
    public partial class winDisplayOption : Window
    {
        public winDisplayOption(DisplayOption DisplayOption,Grid3d grid3d)
        {
            InitializeComponent();
            this.DisplayOptions = (DisplayOption)DisplayOption.Clone();
            this.DataContext = this.DisplayOptions;
            this.grid3D = grid3d;
        }

        private Grid3d grid3D;

        public Grid3d Grid3D
        {
            get { return grid3D; }
            set { grid3D = value; }
        }

        private DisplayOption _DisplayOptions = new DisplayOption();

        public DisplayOption DisplayOptions
        {
            get { return _DisplayOptions; }
            set { _DisplayOptions = value; }
        }

        private void lvApp_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ShowTabData(this.lvApp.SelectedIndex);
        }

        private void ShowTabData(int index)
        {
            switch (index)
            {
                case 0:
                    this.tabgrid.Visibility = System.Windows.Visibility.Visible;
                    this.tabMap.Visibility = System.Windows.Visibility.Collapsed;
                    this.tabModflow.Visibility = System.Windows.Visibility.Visible;
                    this.tabPrec.Visibility = System.Windows.Visibility.Visible;
                    this.tabSubContent.SelectedIndex = index;
                    break;
                case 1:
                    this.tabgrid.Visibility = System.Windows.Visibility.Collapsed;
                    this.tabMap.Visibility = System.Windows.Visibility.Visible;
                    this.tabModflow.Visibility = System.Windows.Visibility.Collapsed;
                    this.tabPrec.Visibility = System.Windows.Visibility.Collapsed;
                    this.tabSubContent.SelectedIndex = 3;
                    break;              
            }
        }

        private void btnColor_Click(object sender, RoutedEventArgs e)
        {

            System.Windows.Forms.ColorDialog dlg = new System.Windows.Forms.ColorDialog();
            Color color = new Color();
            dlg.Color = System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B);

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                //this .RectColor.Fill = Color.FromArgb(dlg.Color.A, dlg.Color.R, dlg.Color.G, dlg.Color.B);

                SolidColorBrush solidColorBrush = new SolidColorBrush(Color.FromArgb(dlg.Color.A, dlg.Color.R, dlg.Color.G, dlg.Color.B));
                //this.RectColor.Fill = solidColorBrush;
            }


            //System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();
            ////dlg.Color = System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B);
            //if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            //{
            //    //System.Drawing.SolidBrush sb = new System.Drawing.SolidBrush(color);
            //    //SolidColorBrush solidColorBrush = new SolidColorBrush(Color.FromArgb(sb.Color.A, sb.Color.R, sb.Color.G, sb.Color.B));
            //    //Application.Current.MainWindow.Background = solidColorBrush;
            //}

        }

        private void btnContourOption_Click(object sender, RoutedEventArgs e)
        {
           

            //HA.ModFlow.Controls.Windows.DisplayOptions.winContourOptionV2 win = new HA.ModFlow.Controls.Windows.DisplayOptions.winContourOptionV2(this.DisplayOptions.Grid3d.Contour);
            //win.Owner = this;
            //if (win.ShowDialog().Value)
            //{
            //    //this._contourCopy.ResetContourLines(this._contourCopy.ContourLines);
            //    this.DisplayOptions.Grid3d.Contour.ReSetContourOption(win.ContourCopy );
            //}
        }


        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.lvApp.SelectedIndex = 0;

            System.Drawing.Color color = this.DisplayOptions.Modflow.Wells.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnCross.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Modflow.Wells.DisplayShape);

            color = this.DisplayOptions.Modflow.Drains.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnCircularpoints.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Modflow.Drains.DisplayShape);

            color = this.DisplayOptions.Modflow.Rivers.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnTriangle.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Modflow.Rivers.DisplayShape);

            color = this.DisplayOptions.Modflow.GeneralHead.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnSquare.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Modflow.GeneralHead.DisplayShape);

            color = this.DisplayOptions.Modflow.ConstantHead.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnDiamond.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Modflow.ConstantHead.DisplayShape);

            color = this.DisplayOptions.Modflow.TransientData.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnTriangleNoFill.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Modflow.TransientData.DisplayShape);

            color = this.DisplayOptions.Modflow.HorizFlowBarrier.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnLine.Content = this.DisplayOptions.Modflow.GetStyle(2, clr, this.DisplayOptions.Modflow.HorizFlowBarrier.DisplayShape);

            color = this.DisplayOptions.Modflow.DryCell.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnDryCell.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Modflow.DryCell.DisplayShape);

            color = this.DisplayOptions.Modflow.WaterTable.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnWaterTable.Content = this.DisplayOptions.Modflow.GetStyle(2, clr, this.DisplayOptions.Modflow.WaterTable.DisplayShape);

            color = this.DisplayOptions.Modflow.MarkFloodedCell.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnMarkFloodedCell.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Modflow.MarkFloodedCell.DisplayShape);


            SolidColorBrush solidColorBrush = new SolidColorBrush(Color.FromArgb(this._DisplayOptions.BackColor.A, this._DisplayOptions.BackColor.R, this._DisplayOptions.BackColor.G, this._DisplayOptions.BackColor.B));
            this.groundRectColor.Fill = solidColorBrush;

            //map-----------------------
            color = this.DisplayOptions.Map.Barrier.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnBarrier.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Map.Barrier.DisplayShape);

            color = this.DisplayOptions.Map.Drain.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnDrain.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Map.Drain.DisplayShape);

            color = this.DisplayOptions.Map.GeneralHead.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnGeneralHead.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Map.GeneralHead.DisplayShape);

            color = this.DisplayOptions.Map.IBound.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnIBound.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Map.IBound.DisplayShape);

            color = this.DisplayOptions.Map.MassLoad.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnMassLoad.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Map.MassLoad.DisplayShape);

            color = this.DisplayOptions.Map.River.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnRiver.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Map.River.DisplayShape);

            color = this.DisplayOptions.Map.Seepage.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnSeepage.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Map.Seepage.DisplayShape);

            color = this.DisplayOptions.Map.SpecifiedConc.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnSpecifiedConc.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Map.SpecifiedConc.DisplayShape);

            color = this.DisplayOptions.Map.SpecifiedFlow.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnSpecifiedFlow.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Map.SpecifiedFlow.DisplayShape);

            color = this.DisplayOptions.Map.SpecifiedHead.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnSpecifiedHead.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Map.SpecifiedHead.DisplayShape);

            color = this.DisplayOptions.Map.Well.Color;
            clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            this.btnWell.Content = this.DisplayOptions.Modflow.GetStyle(14, clr, this.DisplayOptions.Map.Well.DisplayShape);
        }

        private void btnCross_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Modflow.Wells.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Modflow.Wells.Size, this.DisplayOptions.Modflow.Wells.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnCross.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Modflow.Wells.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Modflow.Wells.Size = win.Size;
                this.DisplayOptions.Modflow.Wells.DisplayShape = win.Displayshape;
            }
        }

        private void btnCircularpoints_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Modflow.Drains.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Modflow.Drains.Size, this.DisplayOptions.Modflow.Drains.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnCircularpoints.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Modflow.Drains.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Modflow.Drains.Size = win.Size;
                this.DisplayOptions.Modflow.Drains.DisplayShape = win.Displayshape;
            }
        }

        private void btnTriangle_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Modflow.Rivers.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Modflow.Rivers.Size, this.DisplayOptions.Modflow.Rivers.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnTriangle.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Modflow.Rivers.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Modflow.Rivers.Size = win.Size;
                this.DisplayOptions.Modflow.Rivers.DisplayShape = win.Displayshape;
            }
        }

        private void btnSquare_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Modflow.GeneralHead.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Modflow.GeneralHead.Size, this.DisplayOptions.Modflow.GeneralHead.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnSquare.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Modflow.GeneralHead.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Modflow.GeneralHead.Size = win.Size;
                this.DisplayOptions.Modflow.GeneralHead.DisplayShape = win.Displayshape;
            }
        }

        private void btnDiamond_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Modflow.ConstantHead.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Modflow.ConstantHead.Size, this.DisplayOptions.Modflow.ConstantHead.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnDiamond.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Modflow.ConstantHead.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Modflow.ConstantHead.Size = win.Size;
                this.DisplayOptions.Modflow.ConstantHead.DisplayShape = win.Displayshape;
            }
        }

        private void btnTriangleNoFill_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Modflow.TransientData.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Modflow.TransientData.Size, this.DisplayOptions.Modflow.TransientData.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnTriangleNoFill.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Modflow.TransientData.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Modflow.TransientData.Size = win.Size;
                this.DisplayOptions.Modflow.TransientData.DisplayShape = win.Displayshape;
            }
        }

        private void btnLine_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Modflow.HorizFlowBarrier.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winLineProperty win = new winLineProperty(clr, this.DisplayOptions.Modflow.HorizFlowBarrier.Size, this.DisplayOptions.Modflow.HorizFlowBarrier.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnLine.Content = this._DisplayOptions.Modflow.GetStyle(2, win.Clr, win.Displayshape);
                Color cl = win.Clr;
                this.DisplayOptions.Modflow.HorizFlowBarrier.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Modflow.HorizFlowBarrier.Size = win.Size;
                this.DisplayOptions.Modflow.HorizFlowBarrier.DisplayShape = win.Displayshape;
            }
        }

        private void btnDryCell_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Modflow.DryCell.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Modflow.DryCell.Size, this.DisplayOptions.Modflow.DryCell.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnDryCell.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Modflow.DryCell.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Modflow.DryCell.Size = win.Size;
                this.DisplayOptions.Modflow.DryCell.DisplayShape = win.Displayshape;
            }
        }

        private void btnWaterTable_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Modflow.WaterTable.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winLineProperty win = new winLineProperty(clr, this.DisplayOptions.Modflow.WaterTable.Size, this.DisplayOptions.Modflow.WaterTable.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnWaterTable.Content = this._DisplayOptions.Modflow.GetStyle(2, win.Clr, win.Displayshape);
                Color cl = win.Clr;
                this.DisplayOptions.Modflow.WaterTable.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Modflow.WaterTable.Size = win.Size;
                this.DisplayOptions.Modflow.WaterTable.DisplayShape = win.Displayshape;
            }
        }

        private void btnMarkFloodedCell_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Modflow.MarkFloodedCell.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Modflow.MarkFloodedCell.Size, this.DisplayOptions.Modflow.MarkFloodedCell.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnMarkFloodedCell.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Modflow.MarkFloodedCell.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Modflow.MarkFloodedCell.Size = win.Size;
                this.DisplayOptions.Modflow.MarkFloodedCell.DisplayShape = win.Displayshape;
            }
        }

        private void btnGroundColor_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.ColorDialog dlg = new System.Windows.Forms.ColorDialog();
            // Color color = new Color();
            //color= this._DisplayOptions.BackColor;
            //dlg.Color = System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B);

            dlg.Color = this._DisplayOptions.BackColor;
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                //this .RectColor.Fill = Color.FromArgb(dlg.Color.A, dlg.Color.R, dlg.Color.G, dlg.Color.B);

                SolidColorBrush solidColorBrush = new SolidColorBrush(Color.FromArgb(dlg.Color.A, dlg.Color.R, dlg.Color.G, dlg.Color.B));
                this.groundRectColor.Fill = solidColorBrush;
                this._DisplayOptions.BackColor = dlg.Color;
            }

        }



        private void btnSpecifiedHead_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Map.SpecifiedHead.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Map.SpecifiedHead.Size, this.DisplayOptions.Map.SpecifiedHead.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnSpecifiedHead.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Map.SpecifiedHead.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Map.SpecifiedHead.Size = win.Size;
                this.DisplayOptions.Map.SpecifiedHead.DisplayShape = win.Displayshape;
            }
        }

        private void btnIBound_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Map.IBound.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Map.IBound.Size, this.DisplayOptions.Map.IBound.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnIBound.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Map.IBound.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Map.IBound.Size = win.Size;
                this.DisplayOptions.Map.IBound.DisplayShape = win.Displayshape;
            }
        }

        private void btnSpecifiedConc_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Map.SpecifiedConc.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Map.SpecifiedConc.Size, this.DisplayOptions.Map.SpecifiedConc.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnSpecifiedConc.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Map.SpecifiedConc.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Map.SpecifiedConc.Size = win.Size;
                this.DisplayOptions.Map.SpecifiedConc.DisplayShape = win.Displayshape;
            }
        }

        private void btnSpecifiedFlow_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Map.SpecifiedFlow.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Map.SpecifiedFlow.Size, this.DisplayOptions.Map.SpecifiedFlow.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnSpecifiedFlow.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Map.SpecifiedFlow.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Map.SpecifiedFlow.Size = win.Size;
                this.DisplayOptions.Map.SpecifiedFlow.DisplayShape = win.Displayshape;
            }
        }

        private void btnGeneralHead_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Map.GeneralHead.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Map.GeneralHead.Size, this.DisplayOptions.Map.GeneralHead.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnGeneralHead.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Map.GeneralHead.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Map.GeneralHead.Size = win.Size;
                this.DisplayOptions.Map.GeneralHead.DisplayShape = win.Displayshape;
            }
        }

        private void btnMassLoad_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Map.MassLoad.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Map.MassLoad.Size, this.DisplayOptions.Map.MassLoad.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnMassLoad.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Map.MassLoad.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Map.MassLoad.Size = win.Size;
                this.DisplayOptions.Map.MassLoad.DisplayShape = win.Displayshape;
            }
        }

        private void btnDrain_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Map.Drain.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Map.Drain.Size, this.DisplayOptions.Map.Drain.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnDrain.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Map.Drain.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Map.Drain.Size = win.Size;
                this.DisplayOptions.Map.Drain.DisplayShape = win.Displayshape;
            }
        }

        private void btnSeepage_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Map.Seepage.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Map.Seepage.Size, this.DisplayOptions.Map.Seepage.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnSeepage.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Map.Seepage.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Map.Seepage.Size = win.Size;
                this.DisplayOptions.Map.Seepage.DisplayShape = win.Displayshape;
            }
        }

        private void btnRiver_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Map.River.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Map.River.Size, this.DisplayOptions.Map.River.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnRiver.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Map.River.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Map.River.Size = win.Size;
                this.DisplayOptions.Map.River.DisplayShape = win.Displayshape;
            }
        }

        private void btnBarrier_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Map.Barrier.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Map.Barrier.Size, this.DisplayOptions.Map.Barrier.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnBarrier.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Map.Barrier.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Map.Barrier.Size = win.Size;
                this.DisplayOptions.Map.Barrier.DisplayShape = win.Displayshape;
            }
        }

        private void btnWell_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Color color = this.DisplayOptions.Map.Well.Color;
            Color clr = Color.FromArgb(color.A, color.R, color.G, color.B);
            winSysbolAttributes win = new winSysbolAttributes(clr, this.DisplayOptions.Map.Well.Size, this.DisplayOptions.Map.Well.DisplayShape);
            win.Owner = this;
            if (win.ShowDialog().Value)
            {
                this.btnWell.Content = this._DisplayOptions.Modflow.GetStyle(14, win.Clr2, win.Displayshape);
                Color cl = win.Clr2;
                this.DisplayOptions.Map.Well.Color = System.Drawing.Color.FromArgb(cl.A, cl.R, cl.G, cl.B);
                this.DisplayOptions.Map.Well.Size = win.Size;
                this.DisplayOptions.Map.Well.DisplayShape = win.Displayshape;
            }
        }



        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            //this._DisplayOptions.ResetDisplayOption(this._DisplayOptions);
            this.DialogResult = true;
            this.Close();
        }

        private void btnCancal_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void txtZmagnif_TextChanged(object sender, TextChangedEventArgs e)
        {
            //if (Convert.ToDouble(this.txtZmagnif.Text) <= 0)
            //{
            //    this.txtZmagnif.Text = "1";
            //}
        }

        private void btnVectorOption_Click(object sender, RoutedEventArgs e)
        {
            //winVectorsOption win = new winVectorsOption(this._DisplayOptions.Grid3d.Vector);
            //win.Owner = this;
            //if (win.ShowDialog().Value)
            //{
            //    if (this.grid3D != null)
            //    {

            //        DSModflow ds = (DSModflow)grid3D.GetDatasetCollection(DataConstName.ModflowResult);

            //        if (ds != null)
            //        {
            //            if (ds.VectorGridData != null)
            //            {

            //                if (win.DoVector.IsAutoCompLength)
            //                {
            //                    int colindex = grid3D.ModFlowGrid.ColCoords.Length - 1;
            //                    int rowindex = grid3D.ModFlowGrid.RowCoords.Length - 1;
            //                    double col = grid3D.ModFlowGrid.ColCoords[colindex];
            //                    double row = grid3D.ModFlowGrid.RowCoords[rowindex];
            //                    double value = FlowVectorsAutoCompute.ComputeLength(grid3D.ModFlowGrid.ColsCount, grid3D.ModFlowGrid.RowsCount, col, row);
            //                    win.DoVector.Length = value;
            //                }
            //                if (win.DoVector.IsAutoCompScaling)
            //                {

            //                    double range = ds.VectorGridData.MaxVectorValue - ds.VectorGridData.MinVectorValue;
            //                    double scaValue = FlowVectorsAutoCompute.ComputeScalingRatio(range, win.DoVector.Length);
            //                    win.DoVector.Scaling = scaValue;

            //                }


            //            }

            //        }

            //        this._DisplayOptions.Grid3d.Vector.ResetVecorOption(win.DoVector);
            //    }

            //}
        }



    }
}
